package com.example.swordjava;


public class Test43 {

    public static void main(String[] args) {

        int[][] a = {{1, 2, 3, 4},
                {5, 6, 7, 8},
                {9, 10, 11, 12},
                {13, 14, 15, 16}};

        System.out.println(9 / 10);

    }

    public class TreeNode {
        int val = 0;
        TreeNode left = null;
        TreeNode right = null;

        public TreeNode(int val) {
            this.val = val;

        }
    }

    /**
     * 整数中1出现的次数（从1到n整数中1出现的次数）
     * 输入一个整数 n ，求 1～n 这 n 个整数的十进制表示中 1 出现的次数
     */
    public int NumberOf1Between1AndN_Solution(int n) {
        int ans = 0;
        for (int i = 1; i <= n; i++) {
            ans += numberOf1(i);
        }
        return ans;
    }

    private int numberOf1(int n) {
        int cnt = 0;
        while (n >= 1) {
            if (n % 10 == 1) {
                cnt++;
            }
            n = n / 10;
        }
        return cnt;
    }

}














